package com.sinven.util;

import com.sinven.common.ActionResult;
import com.sinven.pojo.Apply;

import java.util.List;

public class ResultUtil{

    public static <T>ActionResult<T> success(){
        ActionResult<T> actionResult = new ActionResult<>();
        actionResult.setCode(200);
        actionResult.setMsg("请求成功");
        return actionResult;
    }

    public static <T>ActionResult<T> success(T data){
        ActionResult<T> actionResult = new ActionResult<>();
        actionResult.setCode(200);
        actionResult.setMsg("请求成功");
        actionResult.setData(data);
        return actionResult;
    }
    public static <T>ActionResult<T> success(long count ,T data){
        ActionResult<T> actionResult = new ActionResult<>();
        actionResult.setCode(200);
        actionResult.setMsg("请求成功");
        actionResult.setCount(count);
        actionResult.setData(data);
        return actionResult;
    }
    public static ActionResult<Void> error(int code , String msg){
        ActionResult<Void> actionResult = new ActionResult<>();
        actionResult.setCode(code);
        actionResult.setMsg(msg);
        return actionResult;
    }

    public static <T>ActionResult<T> success(int code, long count, T data) {
        ActionResult<T> actionResult = new ActionResult<>();
        actionResult.setCode(code);
        actionResult.setMsg("请求成功");
        actionResult.setCount(count);
        actionResult.setData(data);
        return actionResult;
    }
}
